//
//  HLAboutHeaderView.m
//  YueYue
//
//  Created by hulu001 on 2023/5/19.
//

#import "HLAboutHeaderView.h"

@interface HLAboutHeaderView ()

@property (nonatomic, strong) UIImageView *iconView;
@property (nonatomic, strong) UILabel *nameLabel;
@property (nonatomic, strong) UILabel *versionLabel;

@end

@implementation HLAboutHeaderView

- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithReuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = HLBackgroundColor;
        self.contentView.backgroundColor = HLBackgroundColor;
        [self setupView];
    }
    return self;
}


- (void)setupView {
    
    
    self.iconView = [[UIImageView alloc] init];
    _iconView.image = UIImageMake(@"about_icon");
    _iconView.layer.masksToBounds = YES;
    _iconView.layer.cornerRadius = 20;
    [self.contentView addSubview:_iconView];
    [_iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(20);
        make.size.mas_equalTo(80);
        make.top.mas_equalTo(NavigationContentTopConstant + 30);
    }];
    
    NSDictionary *appInfo = [[NSBundle mainBundle] infoDictionary];
    NSString *appName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"];
    self.nameLabel = [[UILabel alloc] init];
    _nameLabel.font = UIFontMediumMake(22);
    _nameLabel.textColor = HLTextColor1;
    _nameLabel.text = appName;
    [self.contentView addSubview:_nameLabel];
    [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_iconView);
        make.top.equalTo(_iconView.mas_bottom).offset(20);
    }];

    self.versionLabel = [[UILabel alloc] init];
    _versionLabel.font = UIFontMediumMake(16);
    _versionLabel.textColor = HLTextColor3;
    _versionLabel.text = [NSString stringWithFormat:@"版本号%@", [appInfo objectForKey:@"CFBundleShortVersionString"]];
    [self.contentView addSubview:_versionLabel];
    [_versionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_nameLabel);
        make.top.equalTo(_nameLabel.mas_bottom).offset(8);
        make.bottom.mas_equalTo(-40);
    }];

    
}


+ (NSString *)identifyCell
{
    return NSStringFromClass([self class]);
}

@end
